package com.lyy.consolidate.homework4;


/**
 * @Author:  GZQ
 * @date:  2024/12/1 23:37
 * @description: 巩固练习4
 */

class Scientist extends Employee{ // 子类

    // 属性
    // (3)科学家除基本工资外,还有年终奖 bonus
    private double bonus;

    public Scientist(String name, double sal) {
        super(name, sal);
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }

    // 重写年工资方法
    @Override
    public void printSalary() {
        System.out.println("科学家 " + getName() + " 的年工资是 " + (getSal() * getSalMonth() + bonus));
    }
}
